package com.kingdee.Utils;

import com.kingdee.model.Contacts;

/**
 * Created by Administrator on 2016/12/27.
 */
public class TimeVaildCheck {
    public static boolean isTimeVaild(String timeString) {
        if (isTimeFormateOk(timeString)) {
            return true;
        }
        return false;
    }

    private static boolean isTimeLengthRight(String timeString) {
        if (timeString != null && timeString.length() == Contacts.timeLength) {
            return true;
        }
        return false;
    }

    private static boolean isTimeFormateOk(String timeString) {
        if (timeString != null && timeString.contains(Contacts.timeSplit) && isTimeLengthRight(timeString)) {
            String[] stringList = timeString.split(Contacts.timeSplit);
            if (stringList[0].matches("\\d{2}") && stringList[1].matches("\\d{2}")) {
                return true;
            }
        }
        return false;
    }

}
